</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>点击复制按钮复制input框里的内容</title>
</head>
<body>
	
<input  id="copyInput" type="text" name="copyLink"  onclick="this.select()" readonly="readonly" value="挨踢小子最棒！！！" >
<a onclick="oCopy(copyInput)">复制</a>
<hr />
<textarea  id="copyText" name="" rows="" cols="" >挨踢小子最帅！！！</textarea>
<a onclick="oCopy(copyText)">复制</a>
   	<!--括号里面传入的是元素 ,只能传入id名-->
<script>
function oCopy(obj){ 
		obj.select();  
		document.execCommand("Copy");
}  
</script> 
</body>
</html>